home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Biodiversity of Illinois 2: Woodland Habitats
/
Biodiversity of Illinois 2 - Woodland Habitats.iso
/
mac
/
casts
/
PDFxtraBehaviors.cst
/
00014_Script_PDF_ZoomTo
< prev
next >
Wrap
Text File
|
2006-07-11
|
4KB
|
115 lines
-- Zoom To
Property pEvent, pSprite, pZoom, pScale, pAlertFlag
on doZoomTo me
case pZoom of:
"Fit Width": set m = #fitWidth
"Actual Size": set m = #actualSize
"Fit Page": set m = #fitPage
"Fit Visible": set m = #fitVisible
otherwise:
if (pScale<8) or (pScale>1600) then
alert "Invalid zoom value"
exit
else
set m = #useScale
end if
end case
set err = PDF_ZoomTo(sprite pSprite, m, pScale)
if PDF_status(sprite pSprite) then alert "PDF Behavior Error"&RETURN&PDF_error(sprite pSprite)
end doZoomTo
on mouseUp me
if (pEvent = #mouseUp) then doZoomTo(me)
end mouseUp
on mouseDown me
if (pEvent = #mouseDown) then doZoomTo(me)
end mouseDown
on prepareFrame me
if (pEvent = #prepareFrame) then doZoomTo(me)
end prepareFrame
-- standard behavior stuff --
on getPropertyDescriptionList me
set defaultValues = GetDefaultValues (me)
set pdfSpriteList = getProp (defaultValues, #spriteList)
set defSprite = getProp (defaultValues, #defaultSprite)
if (defSprite=0) then
if the ticks - pAlertFlag > 10 then
alert "Please create a sprite of type PDF first."
end if
set pAlertFlag = the ticks -- The ticks when the user clicked "OK"
exit
end if
set p_list = [:]
addprop p_list, #pEvent, [ #comment: "Event", #format:#symbol, #range:[#mouseUp, #mouseDown, #prepareFrame], #default:#mouseUp]
addprop p_list, #pSprite, [ #comment: "PDF Sprite is in channel:", #format:#symbol, #range:pdfSpriteList, #default:defSprite]
addprop p_list, #pZoom, [ #comment: "Zoom to:", #format:#symbol, #range:["Fit Width", "Actual Size", "Fit Page","Fit Visible", "Other (specify below)"], #default:"Fit Width"]
addprop p_list, #pScale, [ #comment: "Other (8..1600):", #format:#integer, #default:""]
return p_list
end
on getBehaviorDescription
tmp = "Zoom to specified view (Fit Width, Actual Size, Fit Page) or to specified percentage (8% to 1600%)"
tmp = tmp & RETURN& "Available for Windows only, Acrobat or Reader."
tmp = tmp &RETURN&RETURN& "--- PARAMETERS ---"
tmp = tmp &RETURN& " - Event: mouseUp, mouseDown, or prepareFrame"
tmp = tmp &RETURN& " - Sprite is in channel: which channel contains the PDF Sprite"
tmp = tmp & RETURN& " - Zoom to: Fit Width, Actual Size, Fit Page, Fit Visible, Other."
tmp = tmp & RETURN& " - Other zoom (8..1600): A number representing the percentage to scale the document."
tmp = tmp &RETURN&RETURN& "Free to use and abuse. (c)1999 - 2005, Integration New Media, Inc." &RETURN& "Thanks to James Newton for his suggestions"
return tmp
end
on getBehaviorTooltip
tmp = "Zoom to specified view (Fit Width, Actual Size, Fit Page)" &RETURN& "or to specified percentage (8% to 1600%)"
tmp = tmp & RETURN& "Available for Windows only, Acrobat or Reader."
return tmp
end
-- utils --
on GetDefaultValues me
if the currentSpriteNum then
set spriteList = GetSpriteList (me #PDF)
if count (spriteList) then
set defaultSprite = getAt (spriteList, 1)
else
set defaultSprite = 0
end if
return [#spriteList: spriteList, #defaultSprite: defaultSprite]
else -- the currentSpriteNum = 0
-- Director is merely recompiling this script: return dummy values
return [#spriteList: [1], #defaultSprite: 1]
end if
end
on GetSpriteList me, memberType
-- return list of sprites of type memberType in current frame
global version
if (char 1 of version = 6) then
set maxSprite = 120
else
set maxSprite = the lastChannel
end if
set aList=[]
repeat with i = 1 to maxSprite
set spriteMember = the member of sprite i
-- if (string(m) contains "member 0") then next repeat -- unnecessary
if (the type of spriteMember = memberType) then -- (JN) Line break
append (aList, i)
end if
end repeat
return aList
end GetSpriteList